package com.lyx.Exercise;

import java.text.SimpleDateFormat;
import java.util.Date;

public class ShowDataTime {

    public static void main(String[] args) {
        System.out.println(dateToString(new Date()));
        System.out.println(dateTimeToString(new Date()));
    }

    public static String dateToString(Date data){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
        return simpleDateFormat.format(data);
    }

    public static String dateTimeToString(Date time){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(time);
    }
}
